package com.besttone.widget;

import com.besttone.search.R;

import android.content.Context;
import android.util.AttributeSet;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.LinearLayout;

public class ButtonSearchBar extends LinearLayout implements
		View.OnClickListener {
	private Button btnSearch;
	private ButtonSearchBarListener mListener;

	public ButtonSearchBar(Context paramContext) {
		super(paramContext);
	}

	public ButtonSearchBar(Context paramContext, AttributeSet paramAttributeSet) {
		super(paramContext, paramAttributeSet);
	}

	public void onClick(View paramView) {
//		if (this.mListener != null)
//			this.mListener.onSearchRequested();
	}

	protected void onFinishInflate() {
		super.onFinishInflate();
//		this.btnSearch = ((Button) findViewById(R.id.start_search));
//		this.btnSearch.setOnClickListener(this);
	}

	public void onVoiceKeyword(String paramString) {
		if (this.mListener != null)
			this.mListener.onSearchRequested(paramString);
	}

	public void setButtonSearchBarListener(
			ButtonSearchBarListener paramButtonSearchBarListener) {
		this.mListener = paramButtonSearchBarListener;
	}

	public void setGaTag(String paramString) {
	}

	public void setHint(int paramInt) {
		if (this.btnSearch == null);
		while (true) {
			if (paramInt > 0) {
				this.btnSearch.setHint(paramInt);
				continue;
			}
			this.btnSearch.setHint(R.string.search_hint);
			return;
		}
	}

	public void setHint(String paramString) {
		if (this.btnSearch != null)
			this.btnSearch.setHint(paramString);
	}

	public void setKeyword(String paramString) {
		if (this.btnSearch != null)
			this.btnSearch.setText(paramString);
	}

	public static abstract interface ButtonSearchBarListener {
		public abstract void onSearchRequested();

		public abstract void onSearchRequested(String paramString);
	}
}